/*
 * krautchantasksendpost.h
 *
 *  Created on: Oct 7, 2011
 *      Author: anonovermind <anonovermind@gmail.com>
 */

#ifndef KRAUTCHANTASKSENDPOST_H_
#define KRAUTCHANTASKSENDPOST_H_

#include "tasks/tasksendpost.h"

namespace Wishmaster {

class KrautchanAgent;
class KrautchanTaskSendPost: public TaskSendPost {
	Q_OBJECT
public:
	KrautchanTaskSendPost(const PostDescriptor& post, const QString& captcha, Wishmaster2::Network::RequestManager* requestManager,
			const QString& msg, KrautchanAgent* agent);
	virtual ~KrautchanTaskSendPost();

	ThreadId threadId() const;

signals:
	void result(KrautchanTaskSendPost* task, const QByteArray& data, const QString& contentType);
protected:
	virtual Wishmaster2::Network::RequestPtr makeRequest(const PostDescriptor& post, const QString& captcha,
			Wishmaster2::Network::RequestManager* requestManager);

	virtual void onRequestDone();

private:
	QString defaultedString(const QString& str, const QString& def);

	PostDescriptor m_post;
	QString m_captcha;
	KrautchanAgent* m_agent;
	Wishmaster2::Network::RequestPtr m_request;
};

} /* namespace Wishmaster */
#endif /* KRAUTCHANTASKSENDPOST_H_ */
